package com.google.qam.util;

public class Shared {

	public static boolean isPowerOf2(int n) {
        return (n & -n) == n;
    }
	
	public static int nextPowerOf2(int n) {
        n -= 1;
        n |= n >>> 16;
        n |= n >>> 8;
        n |= n >>> 4;
        n |= n >>> 2;
        n |= n >>> 1;
        return n + 1;
    }
}
